<?php
namespace think\db\connector;
/**
 * PDO_DBLIB 数据库驱动
 */
class Dblib extends Sqlsrv {
  /**
   * 解析pdo连接的dsn信息
   * @access protected
   * @param array $config 连接信息
   * @return string
   */
  protected function parseDsn($config) {
    $a = $config['hostname'];
    $b = $config['hostport'];
    $c = $config['database'];
    $d = $config['charset'];
    $arr = [];
    if (!empty($a)) {
      $arr[] = 'host='.(empty($b) ? $a : "{$a}:{$b}");
    }
    if (!empty($c)) {
      $arr[] = "dbname={$c}";
    }
    if (!empty($d)) {
      $arr[] = "charset={$d}";
    }
    $dsn = "dblib:".implode(';', $arr);
    return $dsn;
  }
}
